from fastapi import APIRouter, Depends

from app.dos.user_do import userRegisterDo
from app.repositories.user_dao import UserDao
from app.schemas.response_schemas import SuccessResponseSchema
from app.schemas.user_schemas.user_req import UserRegisterReq

from app.services.user_service import UserService

user_router = APIRouter()




# 注册接口
@user_router.post('/register',description='注册接口',summary='用户相关接口')
async def register_user(
        user_req:UserRegisterReq,
        user_service: UserService = Depends(lambda: UserService(UserDao()))
):
    """
    用户注册接口
    :param user_req: 用户注册请求参数
    :param user_service:
    :return:
    """
    user = await user_service.register(user_req)
    return SuccessResponseSchema(data=user)





